<?php
namespace Common\Model;
use Think\Model;
class PaymentConfigModel extends Model {

	/**
	 * 获得配置
	 */
	public function getSettingConfig( $order_id , $pay_type ) {
		$customer_info = M('order')->alias('o')->join('__CUSTOMER__ c ON c.`code` = o.`channel_code`')->where(array('o.id' => $order_id))
								   ->field('c.weixin_pay_id,c.alipay_pay_id')->find();
		$pay_id = 0;
		switch( $pay_type ) {
			case 'weixin' :
				$pay_id = $customer_info['weixin_pay_id'];
			break;
			case 'alipay' :
				$pay_id = $customer_info['alipay_pay_id'];
			break;
		}
		$pay_config = M('payment_config')->where(array('status' => 1 , 'id' => $pay_id))->find();
		if( !$pay_config ) return false;
		return unserialize( $pay_config['info'] );
	}

}